home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / misc / amag / sh9302a.lha / Taktzyklen (S.51) / taktik.s < prev    next >
Text File  |  1993-06-06  |  4KB  |  147 lines

  1.  
  2. ;******** Taktzyklen bestimmen *********
  3. ;*-------------------------------------*
  4. ;* Prog.name:     taktik.s             *
  5. ;*-------------------------------------*
  6. ;* Autor:         Gerald Steffens      *
  7. ;* Copyright:     bei mir              *
  8. ;* Assembler:     A68k                 *
  9. ;* Hardware:      512K,Kickstart1.2    *
  10. ;***************************************
  11.  
  12. ExecBase:         equ      4
  13. OldOpenLibrary:   equ   -408
  14. CloseLibrary:     equ   -414
  15. Output:           equ    -60
  16. Write:            equ    -48
  17. Disable:          equ   -120
  18. Enable:           equ   -126
  19. RawDoFmt:         equ   -522
  20. Umlauf:           equ     99  ; für 100 Umläufe
  21.  
  22. start:            equ      0  ; Register d6 läuft
  23. ende:             equ     20  ; von start bis ende
  24. ; hängt die Testschleife nicht von d6 ab, so reicht start=ende=0
  25.  
  26.  
  27. ;***** hier beginnt der Spaß *****
  28.    move.l   ExecBase,a6       ; es wird
  29.    lea      dosname,a1        ; die Dos-Library
  30.    jsr      OldOpenLibrary(a6); geöffnet
  31.    move.l   d0,dosbase        ; ging alles gut
  32.    beq      abgang            ; nein, dann Abgang
  33.  
  34.    move.l   d0,a6             ; DosBase
  35.    jsr      Output(a6)        ; Output-handle
  36.    move.l   d0,handle         ; Ausgabe-Datei
  37.  
  38.    move.l   #start,count
  39. loop:
  40.    move.l   ExecBase,a6       ; Interrupts
  41.    jsr      Disable(a6)       ; sperren
  42. warte:
  43.    move.l   $dff004,d7        ; um ein Flackern
  44.    andi.l   #$0001ffff,d7     ; des Monitor zu
  45.    lsr.l    #8,d7             ; unterbinden wird
  46.    cmpi.l   #310,d7           ; auf Zeile 310
  47.    bne.s    warte             ; gewartet
  48.  
  49.    move     #$0200,$dff096    ; DMA aus
  50.    move.l   count(pc),d6      ; 
  51.    move     #Umlauf,d7
  52.    lea      $bfd000,a6        ; Hardwarebasis
  53.    move.b   #$00,$e00(a6)     ; Timer A stop
  54.    move.b   #$ff,$400(a6)     ; Low
  55.    move.b   #$ff,$500(a6)     ; High  und speichern
  56.    move.b   #$01,$e00(a6)     ; start
  57.  
  58.  
  59. ;************* Testschleife *************
  60. ;*                                      *
  61. ;*           d0-d5 und a0-a6            *
  62. ;*    stehen zur freien Verfügung       *
  63. ;* d6 durchläuft die Werte start - ende *
  64. ;*    d7 nicht benutzen, weil Zähler    *
  65. ;****************************************
  66.  
  67. testloop:
  68. ;*** hier Testbefehle einfügen ***
  69.  
  70.       mulu    d6,d0
  71.  
  72. ; weitere interessante Befehle und passende Werte    
  73. ;     mulu    #640,d0         ;  0-0
  74. ;     bset    d6,d0           ;  0-20
  75. ;     lsl     d6,d0           ;  0-70
  76. ;     move.b   $bfdd00,d0
  77.  
  78. ;*********************************
  79.    dbra     d7,testloop
  80.  
  81.    lea      $bfd000,a6
  82.    move.b   #$00,$e00(a6)     ; Timer A stop
  83.    move     $500(a6),d7       ; High holen
  84.    move.b   $400(a6),d7       ; Low holen
  85.    move     #$8200,$dff096    ; DMA ein
  86.    movem.l  d0-d5/a0-a6,-(a7) ; sichern
  87.    move.l   ExecBase,a6       ; Interrupts
  88.    jsr      Enable(a6)        ; erlauben
  89.  
  90.    addi     #107,d7           ; Zeit einer Leerschleife
  91.    neg      d7                ;
  92.    add      #2,d7             ; Korrektur ( Rundung )
  93.    ext.l    d7
  94.    divu     #10,d7            ; Taktzahl justieren
  95.    lea      datas,a1          ; Puffer für die Werte
  96.    move.l   count(pc),(a1)+   ; Zählerwert
  97.    ext.l    d7                ; und
  98.    move.l   d7,(a1)           ; Taktzahl
  99.                               ; eintragen
  100.    move.l   ExecBase,a6
  101.    lea      formatstr(pc),a0  ; Formatstring
  102.    lea      datas(pc),a1      ; Data-Puffer
  103.    lea      prog(pc),a2       ; Hilfsroutine
  104.    lea      buffer(pc),a3     ; Ausgabepuffer
  105.    jsr      RawDoFmt(a6)      ; Werte verarbeiten
  106.    move.l   handle(pc),d1     ; Output-handle
  107.    move.l   #buffer,d2        ; Ausgabepuffer
  108.    move.l   textend(pc),d3
  109.    sub.l    #buffer,d3        ; textlänge
  110.    move.l   dosbase(pc),a6
  111.    jsr      Write(a6)         ; Text ausgeben
  112.    movem.l  (a7)+,d0-d5/a0-a6 ; restaurieren
  113.  
  114.    addq.l   #1,count          ; Zähler + 1
  115.    move.l   count(pc),d6      ;
  116.    cmpi.l   #ende,d6          ; Zähler<=ende?
  117.    ble      loop              ; weiter->
  118.  
  119.    move.l   dosbase(pc),a1    ; Dos-Library
  120.    move.l   ExecBase,a6       ; wieder
  121.    jsr      CloseLibrary(a6)  ; schließen
  122. abgang:
  123.    moveq    #0,d0
  124.    rts
  125.  
  126. ; *** Hilfsroutine *** wird von RawDoFmt aufgerufen
  127. prog:
  128.    move.b   d0,(a3)+
  129.    clr.b    (a3)
  130.    move.l   a3,textend
  131.    rts
  132.  
  133.  
  134. count:      dc.l  0
  135. dosbase:    dc.l  0
  136. handle:     dc.l  0
  137. textend:    dc.l  0
  138. datas:      dc.l  0
  139.             dc.l  0
  140. buffer:     ds.b  100
  141.  
  142. dosname:    dc.b  "dos.library",0
  143.    even
  144. formatstr:  dc.b  "nr: %8ld  takte= %5ld",10,0
  145.  
  146.    end
  147.